package com.itheima.Demo6FileWriter;

import java.io.FileWriter;
import java.io.Writer;
//文件赋值用字节流 其他情况勇字符流
public class FileWriterDemo
{
    public static void main(String[] args) {
        //创建一个字符输出流对象，将数据写入到文件中
        try (Writer fw = new FileWriter("src\\com\\itheima\\Demo6FileWriter\\123"))
        {
            fw.write("hello world");
            String s = "hello world";
            fw.write(s);
            //清空缓冲区
            //fw.flush();
        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}
